{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Physical Units Demo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This notebook demonstrates the abilites of the `PhysicalFresnelWavefront` class.\n",
    "\n",
    "The most important change is that the `wavefront` array now contains values that have units of an actual electric field, i.e. V/m. This is of special importance once non-linear effects are of interest. For example, the thermal blooming effect results from a high-energy laser which heats the air and induces refractive-index changes. For this effect to be implemented, one needs to have the intensity distribution in physical units at disposal. The class `PhysicalFresnelWavefront` is designed to provide exactly this.\n",
    "\n",
    "An additional functionality is a rudimentary ability to emulate a beam quality factor. This has been done by scaling the wavelength accordingly. The capability to measure the beam quality factor is also implemented. This is useful in cases of arbitrary initial field distributions, where it might not be known."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Demo 1: Beam Power"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The beam power is very easy to apply. However, be careful when to apply a power, since it may result in unexpected behaviour. When the intensity is scaled before applying an aperture for example, the power will change. Let us begin by importing relevant packages and defining some constants."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import poppy\n",
    "import matplotlib.pyplot as plt\n",
    "import astropy.units as u\n",
    "\n",
    "w0 = 10e-2              # beam radius (m)\n",
    "P0 = 10e3               # beam power (W)\n",
    "w_extend = 6            # weight of the spatial extend\n",
    "wavelength = 1064e-9    # wavelength in vacuum (m)\n",
    "R0 = 100                # initial radius of curvature (m)\n",
    "npix = 256              # spatial resolution"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now lets define a wavefunction and apply an aperture, lens, and power."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P = 10.00 kW\n"
     ]
    }
   ],
   "source": [
    "wf = poppy.PhysicalFresnelWavefront(beam_radius=w_extend*w0*u.m,\n",
    "                                    wavelength=wavelength,\n",
    "                                    npix=npix,\n",
    "                                    oversample=2)\n",
    "\n",
    "wf *= poppy.GaussianAperture(w=w0*u.m)\n",
    "wf *= poppy.QuadraticLens(f_lens=R0*u.m)\n",
    "\n",
    "wf.scale_power(P0)\n",
    "\n",
    "print(\"P = {0:.2f} kW\".format(wf.power*1e-3))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, let us see what happens when we apply the power before the aperture."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P = 0.11 kW\n"
     ]
    }
   ],
   "source": [
    "wf = poppy.PhysicalFresnelWavefront(beam_radius=w_extend*w0*u.m,\n",
    "                                    wavelength=wavelength,\n",
    "                                    npix=npix,\n",
    "                                    oversample=2)\n",
    "\n",
    "wf.scale_power(P0)\n",
    "wf *= poppy.GaussianAperture(w=w0*u.m)\n",
    "wf *= poppy.QuadraticLens(f_lens=R0*u.m)\n",
    "\n",
    "print(\"P = {0:.2f} kW\".format(wf.power*1e-3))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The power values differ from the first result because the power is applied and calculated using the current intensity distribution, which differ as well. So always take care of when to apply the power."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Demo 2: Beam Quality Factor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can assign a beam quality factor to the beam which only scaled the wavelength appropriately. However, from the analytical equation for the beam radius one can see that this should work as expected. Let us test it by using the implemented beam quality measurement calculation based on ISO Standard 11146 (see https://www.rp-photonics.com/beam_quality.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M2 = 3.83\n"
     ]
    }
   ],
   "source": [
    "wf = poppy.PhysicalFresnelWavefront(beam_radius=w_extend*w0*u.m,\n",
    "                                    wavelength=wavelength,\n",
    "                                    npix=npix,\n",
    "                                    oversample=2,\n",
    "                                    M2=3.827)\n",
    "wf *= poppy.GaussianAperture(w=w0*u.m)\n",
    "wf *= poppy.QuadraticLens(f_lens=30*u.cm)\n",
    "wf.scale_power(P0)\n",
    "\n",
    "M2, z, caustic, z_fine, w_fit, rayleigh_length = wf.M2()\n",
    "\n",
    "print(\"M2 = {0:.2f}\".format(M2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I did not test the algorithm to very large extent, but it worked for my purposes. The results of the $M^2$ fitting routine is shown along with the values used to obtain the fit (red dots) in the following Figure."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x24ec58864a8>]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3XlclXX+///HG1kE1MrcNTjVT0TQxCXNLIfSscYaNZ2b02SNaUbLTElapuXSpuUKIaLilgmmljVTqKnlNq4hKiooruCWqTUfNcH1vL9/gP0cAj1Hzjnvs7zut5s3D9e5ONeTC67Xuc7rel/XpbTWCCGE8Bx+pgMIIYSwjxRuIYTwMFK4hRDCw0jhFkIIDyOFWwghPIwUbiGE8DBSuIUQwsNI4RZCCA8jhVsIITyMvzNetEaNGtpisTjjpYUQwitlZWWd0lrXtGVepxRui8XC5s2bnfHSQgjhlZRSBbbOK60SIYTwMFK4hRDCw0jhFkIIDyOFWwgh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at9T3Ad/z/76ommVhXtthC8Wm8zYCJwL9cuXClVBVgIRCvtT5T+ukyvsUl6+wGuYysM631Fa11DNAAaK2UalJqFiPry4ZcLt8elVKPAye01lnXm62MaQ5bX6YK9xHg2nfGBsCx8uZRSvkDt+D8j+U3zKW1/llrfaHky2lASydnsoUt69PltNZnrn7U1VovBgKUUjVcsWylVADFxTFda/1lGbMYWWc3ymVynZUs8/+AVcCjpZ4ysT3eMJeh7bEd0EUplU9xO/VhpVRaqXmcur5MFe5MoKFS6k6lVCDFzfuvS83zNdC75PFfgBW6pNNvMlepPmgXivuUpn0N/L1kpMR9wGmt9Y+mQyml6lzt6ymlWlP89/azC5argBnALq31hHJmc/k6syWXiXWmbLshuMu3R1tymdgetdZDtNYNtNYWimvECq3106Vmc+r68nfUC9lDa31ZKfVPYCnFIzlmaq1zlFLvAZu11l9T/Ac+Rym1j+J3qifdJNerSqkuwOWSXM86O5dS6jOKRxvUUEodAUZQfKAGrfUUYDHFoyT2AYVAH2dnsjHXX4CXlFKXgSLgSRe8+ULxHtEzwI6S/ijAW0DYNdlMrDNbcplYZ3WB2UqpShS/USzQWmeY3h5tzOXy7bE8rlxfcuakEEJ4GDlzUgghPIwUbiGE8DBSuIUQwsNI4RZCCA8jhVsIITyMFG4hhPAwUriFEMLDSOEWQggP8/8A94RBmT6d2x4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot((z_fine-z_fine.min())*1e5, w_fit*1e6, '-k')\n",
    "plt.plot((z-z_fine.min())*1e5, caustic*1e6, 'or')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Demo 3: Normal propagation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Finally, lets have a quik look on how to propagage by examining the field at the focus and printing the power to the console."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P(0m) = 10.00 kW\n",
      "r(0m) = 10.00 cm\n",
      "P(100m) = 9.05 kW\n",
      "r(100m) = 23.33 cm\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARAAAAElCAYAAAAsvb0LAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAH/9JREFUeJzt3Xm0ZWV95vHvc++5A0WhFIVDMUOEOKRdGJEMtlEjEWzTQLdEMTEpbAwtabtXL4clSjqdEOnEDM3Sxo6iUcohgmDbllMTBnGlDSBlFhEBoQpQqa5i0KLQqjvVvffXf+x3H9+7a597T+177lT3+ax11tlnT+c9p+556t3vu/e7FRGYmTXRt9QFMLOVywFiZo05QMysMQeImTXmADGzxhwgZtaYA8R6TtKHJf2XRXqvl0raKmmPpHMX4z3tZxwgK5yk70s6o8t1b5X0loUuU0S8NSL+NL3nKyRtX8C3uwy4MiLWRsT/XqzPaAUHiK10xwP39Gpnkvp7ta/VwAFyEJF0gaT/K+mvJD0p6WFJr0nLLgdeBlyZqvtXpvnPlXSjpF2S7pf0+mx/V0v6kKSvSPqppDsk/VxaJklXSHpc0lOSviPpF7Lt3ifpUOBrwFHpPfdIOkrSiKT12fu8WNITkgZqPtPpkm6TtFvSTklXShpMyx4ETgK+lPb9Zw0/499I+qqkvcAre/qPcrCLCD9W8AP4PnBGmr4A2Af8PtAPXAzsAJSW3wq8Jdv2UOAR4M1AC/hF4EfAC9Lyq4FdwOlp+WeAa9KyM4FvA4cDAp4HbMi2e1+afgWwvVLmrwIXZ6+vAP5Hh8/3YuCX0/ufANwH/Oe6zz+Pz/gU8FKK/1CHl/rfdCU9XAM5+PwgIj4aEVPAJmAD8Kw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3JS9B6vR64Gdiano9I808DPpamfxW4m6Jl+27gwmz7kyj+qLcB1wFDy6TMbwL2AXdlj1PTslvS5/gu8Glg7QKX918BD1D8L3xpmncZxY8PYDh9d9vSd3lStu2labv7gdcs4t/FXGW+CXgs+243z/W3sgzK/GfAPalsXweem23779L3vw14c6/K5FPZzayx1XAIY2YLxAFiZo05QMysMQeImTXmADGzxhwgZtaYA8TMGnOA2IKQdIKk70n6mKTvSvqMpDMkfTONSbEYV93aAnOA2EJ6DvAB4IXAc4HfBv4lxbU5713CclmPOEBsIT0cEXdHcZXwPcDNUZz6fDdwwpKWzHrCAWILaTybns5eT3OQXAm+2jlAzKwxB4iZNearcc2sMddAzKwxB4iZNeYAMbPGHCBm1pgDxMwac4CYWWMOEDNr7P8Dc42VUDHl1zUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQoAAAE0CAYAAADUu30UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAG6NJREFUeJzt3XuYZVV95vHvW/eu7qavSNOKkAiOiqOMKN4NDkSQqCijiHgflciMmXGijtFM1DBRY55kHBEniEpAFDBiUIx4QXkEVESBByKIBhBItw1K36q6urruv/ljrXPYdayqdbrrXvV+nqeeOmfvffZe+1zes/bea62jiMDMbCot810AM1v4HBRmVuSgMLMiB4WZFTkozKzIQWFmRQ4KO2CSzpf0F3O0redKultSn6SXz8U27REOikVC0v2STmxy2e9Leutslyki3h4R/ztv83hJW2dxc+cA50XEqoj46lztoyUOClssDgfunKmVSWqdqXUtBw6KRUjSmyT9QNLfStol6T5JL87zPgw8HzgvV9PPy9OfIO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0FhvHhx7zRNJKSatrt4EXkU6CLnQ/BY6S9HuSOoAzgKsalrkKeGO+/Urg2liCLfskbaqde5F0HOnztGN+SzU7XKOYBZJeAXwSOBj4hqTbIuIkSZuBz0bEKcAhwJX5fdYGXBoR35q3QjcpIkYkvQP4NtAKXBgRd0o6B7g5Iq4CPgdcIukeUk3ijPkr8YGTdBlwPLBR0lbgg0A7QEScTwrBsyWNAPuAM5ZiIIKbcJtZE3zoYWZFDgozK3JQmFmRg8LMihwUZlbkoDCzIgeFmRU5KOyASTpC0i8kfVbSHZK+KOlEST+UdHdurWhLgIPCputI4BPAU4AnAGcCzwPeDbx/HstlM8hBYdN1X0T8LCLGgDuB7+VmzD8DjpjXktmMcVDYdA1Wbo9V7o/hvkRLhoPCzIocFGZW5N6jZlbkGoWZFTkozKzIQWFmRQ4KMytyUJhZkYPCzIocFGZW9P8BlagRuTCePBEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "wf = poppy.PhysicalFresnelWavefront(beam_radius=w_extend*w0*u.m,\n",
    "                                    wavelength=wavelength,\n",
    "                                    npix=npix,\n",
    "                                    oversample=2,\n",
    "                                    M2=3.827)\n",
    "wf *= poppy.GaussianAperture(w=w0*u.m)\n",
    "wf *= poppy.QuadraticLens(f_lens=30*u.m)\n",
    "wf.scale_power(P0)\n",
    "\n",
    "print(\"P(0m) = {0:.2f} kW\".format(wf.power*1e-3))\n",
    "print(\"r(0m) = {0:.2f} cm\".format(wf.radius[0]*1e2))\n",
    "\n",
    "plt.figure(1)\n",
    "wf.display()\n",
    "\n",
    "wf.propagate_fresnel(100*u.m, attenuation_coeff=1e-3)\n",
    "\n",
    "plt.figure(2)\n",
    "wf.display()\n",
    "\n",
    "print(\"P(100m) = {0:.2f} kW\".format(wf.power*1e-3))\n",
    "print(\"r(100m) = {0:.2f} cm\".format(wf.radius[0]*1e2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Conclusion"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The class `PhysicalFresnelWavefront` implemented an alternative units convention for the electric field and intensity. At the moment, this doesn't change any propagation results. However, if accepted to be included into poppy, I can provide a thermal blooming phase screen (implemented as a `OpticalElement`) which relies on physical units of the intensity because it is a non-linear effect. In its current state, the class does not follow with poppy's conventions, e.g. I did not craft it to use astropy's units package whenever possible. My intent is basically to find out if the community and poppy developers are interested in the capabilites this class provides and features that can build upon it (for example a thermal blooming phase screen)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
